package com.xxxx.springboot.shiro.config;

import java.io.Serializable;

import lombok.Data;

@Data
public class ResultVO<T extends Serializable> implements Serializable {

	private static final long serialVersionUID = 1L;

	protected String code;

	protected String message;

	private T data;

	private ResultVO() {
		super();
	}

	private ResultVO(T data) {
		super();
		this.setCode("SUCCESS_CODE");
		this.data = data;
	}

	private ResultVO(String code, String message) {
		super();
		this.code = code;
		this.message = message;
	}

	public static <T extends Serializable> ResultVO<T> success(T data) {
		return new ResultVO<>(data);
	}

	public static <T extends Serializable> ResultVO<T> error(String code, String message) {
		return new ResultVO<>(code, message);
	}

}
